<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<link rel="stylesheet" href="${initParam.root}/css/sunny/jquery-ui-1.9.2.custom.css" />
<link rel="stylesheet" href="${initParam.root }/css/member/main_update.css">
<script type="text/javascript" src="${initParam.root}/js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${initParam.root}/js/jquery-ui-1.9.2.custom.js"></script>

<script type="text/javascript">
$(function(){
		$("#a_anni1").datepicker({
			  dateFormat: "yy-mm-dd",
		         dayNamesMin: ['월', '화', '수', '목', '금', '토', '일'], // 요일의 한글 형식.
		         monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'], // 월의 한글 형식.
		         showMonthAfterYear:true,
		         changeYear:true
		});
		$("#a_anni2").datepicker({
			  dateFormat: "yy-mm-dd",
		         dayNamesMin: ['월', '화', '수', '목', '금', '토', '일'], // 요일의 한글 형식.
		         monthNames: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'], // 월의 한글 형식.
		         showMonthAfterYear:true,
		         changeYear:true
		});
		$("#goUpdateMember").click(function(){
			if($("#userPass").val()==""){
				alert("패스워드를 입력하세요");
				$("#userPass").focus();
				return;
			}else if($("#passConfirm").val()==""){
				alert("패스워드확인을 입력하세요");
				$("#passConfirm").focus();
				return;
			}else if($("#userPass").val()!=$("#passConfirm").val()){
				alert("패스워드가 같지 않습니다");
				$("#userPass").val("");
				$("#passConfirm").val("");
				$("#userPass").focus();
				return;
			}else if($("#anniversary1").val()==""){
				alert("기념일을 선택하세요");
				return; 	
			}else if($("#a_anni").val()==""){
				alert("날짜를 입력하세요");
				return; 	
			}else if($("#anniversary2").val()==""){
				alert("기념일을 선택하세요");
				return; 	
			}else if($("#a_anni").val()==""){
				alert("날짜를 입력하세요");
				return; 	
			}			
			var flag=confirm("변경된 회원 정보를 수정하시겠습니까?");
			if(flag){
					$("#updateForm").submit();
			}
		});  //click
});		//load
		
</script>		
<h3>
<img alt="title" src="${initParam.root }/img/main/update/main-update-title.gif" id="title">
</h3>

<div id="회원수정">
<form action="${initParam.root}/member.do" id="updateForm" name="updateForm">  
<input type="hidden" name="command" value="updateMember">
	<ul id="회원정보1">
		<li><img alt="이름" src="${initParam.root }/img/main/update/main-update-name.gif" class="infoName"> <input type="text" name="m_name" id="userName" value="${sessionScope.loginMember.mvoLogin.m_name }" readonly="readonly"></li>
		<li><img alt="아이디" src="${initParam.root }/img/main/update/main-update-id.gif" class="infoId"> <input type="text"  name="m_id" id="userId" readonly="readonly" value="${sessionScope.loginMember.mvoLogin.m_id }"><br></li>
		<li><img alt="주민등록번호" src="${initParam.root }/img/main/update/main-update-ssn.gif" class="infoSsn"> <img alt="14" src="${initParam.root }/img/main/update/main-update-14.jpg"></li>
		<li><img alt="이메일" src="${initParam.root }/img/main/update/main-update-email.gif" class="infoEmail"> <input type="text"  name="m_email" id="email"  value="${sessionScope.loginMember.mvoLogin.m_email }" readOnly="readOnly"><br></li>
	</ul>
<hr>
	<ul id="회원정보2">
	
		<li><img alt="관심요리" src="${initParam.root }/img/main/update/main-update-favorite.gif" id="관심요리"></li>
		<c:choose>
		<c:when test="${sessionScope.loginMember.mvoLogin.m_likeCook=='한식'}">
		<li>
			<input type="radio" name="m_likeCook"value="한식" checked="checked" class="category">한식
			<input type="radio" name="m_likeCook"value="일식" class="category">일식
			<input type="radio" name="m_likeCook"value="중식" class="category">중식
			<input type="radio" name="m_likeCook"value="양식" class="category">양식
		</li>
		</c:when>
		<c:when test="${sessionScope.loginMember.mvoLogin.m_likeCook=='일식'}">
		<li>
			<input type="radio" name="m_likeCook"value="한식" class="category">한식
			<input type="radio" name="m_likeCook"value="일식" checked="checked" class="category">일식
			<input type="radio" name="m_likeCook"value="중식" class="category">중식
			<input type="radio" name="m_likeCook"value="양식" class="category">양식
		</li>
		</c:when>
		<c:when test="${sessionScope.loginMember.mvoLogin.m_likeCook=='중식'}">
		<li>
			<input type="radio" name="m_likeCook"value="한식" class="category">한식
			<input type="radio" name="m_likeCook"value="일식" class="category">일식
			<input type="radio" name="m_likeCook"value="중식" checked="checked" class="category">중식
			<input type="radio"name= "m_likeCook" value="양식" class="category">양식
		</li>
		</c:when>
		<c:otherwise>
		<li>
			<input type="radio" name="m_likeCook"value="한식" class="category">한식
			<input type="radio" name="m_likeCook"value="일식" class="category">일식
			<input type="radio" name="m_likeCook"value="중식" class="category">중식
			<input type="radio" name="m_likeCook"value="양식" checked="checked" class="category">양식
		</li>
		</c:otherwise>
		</c:choose>
		
		<li><img alt="결혼유무" src="${initParam.root }/img/main/update/main-update-married.gif" id="결혼유무"></li>
		<c:choose>
		<c:when test="${sessionScope.loginMember.mvoLogin.m_married=='기혼'}">
		<input type="radio" value="미혼" name="m_married" class="married">미혼
		<input type="radio" value="기혼" name="m_married" checked="checked" class="married">기혼<br>
		</c:when>
		<c:otherwise>
		<input type="radio" value="미혼" name="m_married"  checked="checked" class="married">미혼
		<input type="radio" value="기혼" name="m_married" class="married">기혼<br>
		</c:otherwise>
		</c:choose>
		
		<li><img alt="성별" src="${initParam.root }/img/main/update/main-update-gender.gif" id="성별"></li>
		<c:choose>
		<c:when test="${sessionScope.loginMember.mvoLogin.m_gender=='m'}">
		<li>
			<input type="radio" name="m_gender" value="m" checked="checked" class="gender">남
			<input type="radio" name="m_gender" value="f" class="gender">여
		</li>
		</c:when>
		<c:otherwise>
		<li>
			<input type="radio" name="m_gender" value="m" class="gender">남
			<input type="radio" name="m_gender" value="f" checked="checked" class="gender">여
		</li>
		</c:otherwise>
		</c:choose>
		
		<li><img alt="기념일" src="${initParam.root }/img/main/update/main-update-anniversary.gif" id="기념일"></li>
		<c:forEach items="${sessionScope.loginMember.anniLogin}" var="anni">
		
		<select id="anniversary${anni.a_no }" name="anniversary${anni.a_no }" class="anniversary">
		<c:choose>
		<c:when test="${anni.a_kind=='생일' }">
				<option value="">---</option>
			<option value="생일" selected="selected">생일</option>
			<option value="기념일">기념일</option>
		</c:when>
		<c:otherwise>
				<option value="">---</option>
			<option value="생일" >생일</option>
			<option value="기념일" selected="selected">기념일</option>
		</c:otherwise>
			</c:choose>
		</select>
		  <input type="text" name="a_date${anni.a_no }" value="${anni.a_date}" id="a_anni${anni.a_no }" class="datepicker"><br>
		</c:forEach>
		<li><input type="button" value="수정하기"  id="goUpdateMember" class="button_img"></li>
	</ul>
</form>
</div>